home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Comm / AmiTCP30b2.lha / src / devs / agnet / simplerexx.h < prev    next >
C/C++ Source or Header  |  1993-10-08  |  3KB  |  119 lines

  1. RCS_ID simplerexx_h_id[]="$Id: simplerexx.h,v 3.1 93/10/07 19:24:33 ppessi Exp $";
  2. /*
  3.  * Simple ARexx interface...
  4.  *
  5.  * This is a very "Simple" interface...
  6.  */
  7.  
  8. #ifndef    SIMPLE_REXX_H
  9. #define    SIMPLE_REXX_H
  10.  
  11. #include    <exec/types.h>
  12. #include    <exec/nodes.h>
  13. #include    <exec/lists.h>
  14. #include    <exec/ports.h>
  15.  
  16. #include    <rexx/storage.h>
  17. #include    <rexx/rxslib.h>
  18.  
  19. /*
  20.  * A structure for the ARexx handler context
  21.  * This is *VERY* *PRIVATE* and should not be touched...
  22.  */
  23. struct    ARexxContext
  24. {
  25. struct    MsgPort    *ARexxPort;    /* The port messages come in at... */
  26. struct    Library    *RexxBase;    /* We will hide the library pointer here... */
  27.     long    Outstanding;    /* The count of outstanding ARexx messages... */
  28.     char    PortName[24];    /* The port name goes here... */
  29.     char    ErrorName[28];    /* The name of the <base>.LASTERROR... */
  30.     char    Extension[8];    /* Default file name extension... */
  31. };
  32.  
  33. #define    AREXXCONTEXT    struct ARexxContext *
  34. #define RexxSysBase     RexxContext->RexxBase
  35.  
  36. /*
  37.  * The value of RexxMsg (from GetARexxMsg) if there was an error returned
  38.  */
  39. #define    REXX_RETURN_ERROR    ((struct RexxMsg *)-1L)
  40.  
  41. /*
  42.  * This function closes down the ARexx context that was opened
  43.  * with InitARexx...
  44.  */
  45. void FreeARexx(AREXXCONTEXT);
  46.  
  47. /*
  48.  * This routine initializes an ARexx port for your process
  49.  * This should only be done once per process.  You must call it
  50.  * with a valid application name and you must use the handle it
  51.  * returns in all other calls...
  52.  *
  53.  * NOTE:  The AppName should not have spaces in it...
  54.  *        Example AppNames:  "MyWord" or "FastCalc" etc...
  55.  *        The name *MUST* be less that 16 characters...
  56.  *        If it is not, it will be trimmed...
  57.  *        The name will also be UPPER-CASED...
  58.  *
  59.  * NOTE:  The Default file name extension, if NULL will be
  60.  *        "rexx"  (the "." is automatic)
  61.  */
  62. AREXXCONTEXT InitARexx(unsigned char *, unsigned char *);
  63.  
  64. /*
  65.  * This function returns the port name of your ARexx port.
  66.  * It will return NULL if there is no ARexx port...
  67.  *
  68.  * This string is *READ ONLY*  You *MUST NOT* modify it...
  69.  */
  70. char *ARexxName(AREXXCONTEXT);
  71.  
  72. /*
  73.  * This function returns the signal mask that the Rexx port is
  74.  * using.  It returns NULL if there is no signal...
  75.  *
  76.  * Use this signal bit in your Wait() loop...
  77.  */
  78. ULONG ARexxSignal(AREXXCONTEXT);
  79.  
  80. /*
  81.  * This function returns a structure that contains the commands sent from
  82.  * ARexx...  You will need to parse it and return the structure back
  83.  * so that the memory can be freed...
  84.  *
  85.  * This returns NULL if there was no message...
  86.  */
  87. struct RexxMsg *GetARexxMsg(AREXXCONTEXT);
  88.  
  89. /*
  90.  * Use this to return a ARexx message...
  91.  *
  92.  * If you wish to return something, it must be in the RString.
  93.  * If you wish to return an Error, it must be in the Error.
  94.  */
  95. void ReplyARexxMsg(AREXXCONTEXT,struct RexxMsg *,char *,LONG);
  96.  
  97. /*
  98.  * This function will send a string to ARexx...
  99.  *
  100.  * The default host port will be that of your task...
  101.  *
  102.  * If you set StringFile to TRUE, it will set that bit for the message...
  103.  *
  104.  * Returns TRUE if it send the message, FALSE if it did not...
  105.  */
  106. short SendARexxMsg(AREXXCONTEXT,char *,short);
  107.  
  108. /*
  109.  * This function will set an error string for the ARexx
  110.  * application in the variable defined as <appname>.LASTERROR
  111.  *
  112.  * Note that this can only happen if there is an ARexx message...
  113.  *
  114.  * This returns TRUE if it worked, FALSE if it did not...
  115.  */
  116. short SetARexxLastError(AREXXCONTEXT,struct RexxMsg *,char *);
  117.  
  118. #endif    /* SIMPLE_REXX_H */
  119.